/**
 * Created by qian.zhou on 2017/2/23.
 */

var React = require('react');
var Active = require('../components/Active');

module.exports = React.createClass({
    getInitialState:function(){
        return {
            cat_id:[],
            goods:[],
            gjlist:[],
            country:{},
        }
    },
    componentDidMount:function(){
        var cat_id = this.state.cat_id;
        for(var i=0;i< cat_id.length;i++){
            this.getProActByCatid(cat_id,i);
        }

    },
    getProActByCatid(cat_id,i){
        var p = this;
        ajax("POST","getProActByCatid",{cat_id},function(dt){
            if(dt&&dt.success){

            }
        })
    },
    render:function(){
        var p = this;
        //for(var i in country){
        //    index++;
        //    console.log(country[i]);
        //    list[index] = country.map(function(obj){
        //
        //        return (
        //            <li key={i} className="pro-con">
        //                <div className="guo_title">
        //                    <img src={country[i][0].picUrl}/>
        //                </div>
        //                <div className="gj-pro">
        //                    <Active actList={country[i]}></Active>
        //                </div>
        //            </li>
        //        )
        //    });
        //
        //    }
        //    console.log(glList);
        //    // = country[i].map(function(obj){
        //    //
        //    //});
        //}
        //var gjList = this.state.goods.map(function(obj){
        //    console.log(obj);
        //    index++;
        //    return(
        //        <li key={index} className="pro-con">
        //            <div className="guo_title">
        //                <img src={obj.picurl} />
        //            </div>
        //            <div className="gj-pro">
        //               <Active></Active>
        //            </div>
        //        </li>
        //    )
        //});
        return (
            <ul className="gj-container">
               <li key={i} className="pro-con">
                   <div className="guo_title">
                       <img src={country[i][0].picUrl}/>
                   </div>
                   <div className="gj-pro">
                       <Active actList={country[i]}></Active>
                   </div>
               </li>
            </ul>
        )
    }

});